home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / germbib / bst / geralpha.bst < prev    next >
Text File  |  1993-04-20  |  27KB  |  1,366 lines

  1. % BibTeX standard bibliography style `plain'
  2.         % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  3.         % Copyright (C) 1985, all rights reserved.
  4.         % Copying of this file is authorized only if either
  5.         % (1) you make absolutely no changes to your copy, including name, or
  6.         % (2) if you do make changes, you name it something other than
  7.         % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
  8.         % This restriction helps ensure that all standard styles are identical.
  9.         % The file btxbst.doc has the documentation for this style.
  10. %   15-feb-92   (MW)    Updated for use with `bibgerman.sty': things like "and"
  11. %                       change with the language. Switch the language using the
  12. %                       language field: 
  13. %                          language = "german" | "USenglish" | "english"
  14. %                       Then a `\selectlanguage{...}' command will be pushed just
  15. %                       before the `\bibitem...' command for the entry in work.
  16.  
  17. ENTRY
  18.   { address
  19.     author
  20.     booktitle
  21.     chapter
  22.     edition
  23.     editor
  24.     howpublished
  25.     institution
  26.     journal
  27.     key
  28.     language
  29.     month
  30.     note
  31.     number
  32.     organization
  33.     pages
  34.     publisher
  35.     school
  36.     series
  37.     title
  38.     type
  39.     volume
  40.     year
  41.   }
  42.   {}
  43.   { label extra.label sort.label }
  44.  
  45. INTEGERS { output.state before.all mid.sentence after.sentence after.block before.title }
  46.  
  47. STRINGS { s t language.state language.temp }
  48.  
  49. FUNCTION {init.state.consts}
  50. { #0 'before.all :=
  51.   #1 'mid.sentence :=
  52.   #2 'after.sentence :=
  53.   #3 'after.block :=
  54.   #4 'before.title :=
  55.   "nostate" 'language.state :=
  56. }
  57.  
  58. FUNCTION {language.state.test}
  59.   'language.temp :=
  60.   language.temp language.state =
  61.     { #1 }
  62.     { #0 }
  63.   if$
  64. }
  65.  
  66. FUNCTION {not}
  67. {   { #0 }
  68.     { #1 }
  69.   if$
  70. }
  71.  
  72. FUNCTION {and}
  73. {   'skip$
  74.     { pop$ #0 }
  75.   if$
  76. }
  77.  
  78. FUNCTION {or}
  79. {   { pop$ #1 }
  80.     'skip$
  81.   if$
  82. }
  83.  
  84. FUNCTION {output.nonnull}
  85. { 's :=
  86.   output.state mid.sentence =
  87.     { ", " * write$ }
  88.     { output.state after.block =
  89.         { add.period$ write$
  90.           newline$
  91.           "\newblock " write$
  92.         }
  93.         { output.state before.all =
  94.             'write$
  95.             % next if is for use with `new' FUNCTION {after.authors}
  96.             { output.state before.title =
  97.                 { ": " * write$ }
  98.                 { add.period$ " " * write$ }
  99.               if$
  100.             }
  101.           if$
  102.         }
  103.       if$
  104.       mid.sentence 'output.state :=
  105.     }
  106.   if$
  107.   s
  108. }
  109.  
  110. FUNCTION {output}
  111. { duplicate$ empty$
  112.     'pop$
  113.     'output.nonnull
  114.   if$
  115. }
  116.  
  117. FUNCTION {output.check}
  118. { 't :=
  119.   duplicate$ empty$
  120.     { pop$ "empty " t * " in " * cite$ * warning$ }
  121.     'output.nonnull
  122.   if$
  123. }
  124.  
  125. FUNCTION {output.bibitem}
  126. { newline$
  127.   language empty$
  128.     'skip$
  129.     { language.state language =
  130.         'skip$
  131.         { "\selectlanguage{\" language * "}" * write$
  132.           newline$
  133.         }
  134.       if$
  135.       language 'language.state :=
  136.     }
  137.   if$
  138.   "\bibitem[" write$
  139.   label write$
  140.   "]{" write$
  141.   cite$ write$
  142.   "}" write$
  143.   newline$
  144.   ""
  145.   before.all 'output.state :=
  146. }
  147.  
  148. FUNCTION {fin.entry}
  149. { add.period$
  150.   write$
  151.   newline$
  152. }
  153.  
  154. FUNCTION {new.block}
  155. { output.state before.all =
  156.     'skip$
  157.     { after.block 'output.state := }
  158.   if$
  159. }
  160.  
  161. FUNCTION {new.sentence}
  162. { output.state after.block =
  163.     'skip$
  164.     { output.state before.all =
  165.         'skip$
  166.         { after.sentence 'output.state := }
  167.       if$
  168.     }
  169.   if$
  170. }
  171.  
  172. % new one -> sets what is specified in FUNCTION {output.nonnull}
  173. % if `before.title 'output.state = ... if$' is true
  174. FUNCTION {after.authors}
  175. { output.state before.all =
  176.     'skip$
  177.     { before.title 'output.state := }
  178.   if$
  179. }
  180.  
  181. FUNCTION {new.block.checka}
  182. { empty$
  183.     'skip$
  184.     'new.block
  185.   if$
  186. }
  187.  
  188. FUNCTION {new.block.checkb}
  189. { empty$
  190.   swap$ empty$
  191.   and
  192.     'skip$
  193.     'new.block
  194.   if$
  195. }
  196.  
  197. FUNCTION {new.block.checkc}
  198. { empty$
  199.   swap$ empty$
  200.   and
  201.     'skip$
  202.     'after.authors
  203.   if$
  204. }
  205.  
  206. FUNCTION {new.sentence.checka}
  207. { empty$
  208.     'skip$
  209.     'new.sentence
  210.   if$
  211. }
  212.  
  213. FUNCTION {new.sentence.checkb}
  214. { empty$
  215.   swap$ empty$
  216.   and
  217.     'skip$
  218.     'new.sentence
  219.   if$
  220. }
  221.  
  222. FUNCTION {field.or.null}
  223. { duplicate$ empty$
  224.     { pop$ "" }
  225.     'skip$
  226.   if$
  227. }
  228.  
  229. FUNCTION {emphasize}
  230. { duplicate$ empty$
  231.     { pop$ "" }
  232.     { "{\em " swap$ * "}" * }
  233.   if$
  234. }
  235.  
  236. FUNCTION {smallcaps}
  237. { duplicate$ empty$
  238.     { pop$ "" }
  239.     { "{\sc " swap$ * "}" * }
  240.   if$
  241. }
  242.  
  243. INTEGERS { nameptr namesleft numnames }
  244.  
  245. FUNCTION {format.names}
  246. { 's :=
  247.   #1 'nameptr :=
  248.   s num.names$ 'numnames :=
  249.   numnames 'namesleft :=
  250.     { namesleft #0 > }
  251.     { nameptr #1 >
  252.         { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ smallcaps 't :=
  253.           namesleft #1 >
  254.             { ", " * t * }
  255.             { numnames #2 >
  256.                 { "english" language.state.test
  257.                   "USenglish" language.state.test
  258.                   or
  259.                      {"," * }
  260.                      'skip$
  261.                   if$
  262.                 }
  263.                 'skip$
  264.               if$
  265.               t "others" =
  266.                 { " \btxetalshort{.}" * }
  267.                 { " \btxandlong{}\ " * t * }
  268.               if$
  269.             }
  270.           if$
  271.         }
  272.         { s nameptr "{ll}{, jj}{, ff}{~vv}" format.name$ smallcaps }
  273.       if$
  274.       nameptr #1 + 'nameptr :=
  275.       namesleft #1 - 'namesleft :=
  276.     }
  277.   while$
  278. }
  279.  
  280. FUNCTION {format.authors}
  281. { author empty$
  282.     { "" }
  283.     { author format.names }
  284.   if$
  285. }
  286.  
  287. FUNCTION {format.editors}
  288. { editor empty$
  289.     { "" }
  290.     { editor format.names
  291.       editor num.names$ #1 >
  292.         { "\ (\btxeditorslong{})" * }
  293.         { "\ (\btxeditorlong{})" * }
  294.       if$
  295.     }
  296.   if$
  297. }
  298.  
  299. FUNCTION {format.title}
  300. { title empty$
  301.     { "" }
  302.     {  "english" language.state.test
  303.        "USenglish" language.state.test
  304.       or
  305.         { title "t" change.case$ emphasize }
  306.         { title emphasize }
  307.       if$
  308.     }
  309.   if$
  310. }
  311.  
  312. FUNCTION {n.dashify}
  313. { 't :=
  314.   ""
  315.     { t empty$ not }
  316.     { t #1 #1 substring$ "-" =
  317.         { t #1 #2 substring$ "--" = not
  318.             { "--" *
  319.               t #2 global.max$ substring$ 't :=
  320.             }
  321.             {   { t #1 #1 substring$ "-" = }
  322.                 { "-" *
  323.                   t #2 global.max$ substring$ 't :=
  324.                 }
  325.               while$
  326.             }
  327.           if$
  328.         }
  329.         { t #1 #1 substring$ *
  330.           t #2 global.max$ substring$ 't :=
  331.         }
  332.       if$
  333.     }
  334.   while$
  335. }
  336.  
  337. FUNCTION {format.date}
  338. { year empty$
  339.     { month empty$
  340.         { "" }
  341.         { "there's a month but no year in " cite$ * warning$
  342.           month
  343.         }
  344.       if$
  345.     }
  346.     { month empty$
  347.         'year
  348.         { month " " * year * }
  349.       if$
  350.     }
  351.   if$
  352. }
  353.  
  354. FUNCTION {format.btitle}
  355. { title emphasize
  356. }
  357.  
  358. FUNCTION {tie.or.space.connect}
  359. { duplicate$ text.length$ #3 <
  360.     { "~" }
  361.     { "\ " }
  362.   if$
  363.   swap$ * *
  364. }
  365.  
  366. FUNCTION {either.or.check}
  367. { empty$
  368.     'pop$
  369.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  370.   if$
  371. }
  372.  
  373. FUNCTION {format.bvolume}
  374. { volume empty$
  375.     { "" }
  376.     { output.state after.block =
  377.         { "\Btxvolumelong{}" }
  378.         { "\btxvolumelong{}" }
  379.       if$
  380.       volume tie.or.space.connect
  381.       series empty$
  382.         'skip$
  383.         { " \btxofserieslong{}\ " * series emphasize * }
  384.       if$
  385.       "volume and number" number either.or.check
  386.     }
  387.   if$
  388. }
  389.  
  390. FUNCTION {format.number.series}
  391. { volume empty$
  392.     { number empty$
  393.         { series field.or.null }
  394.         { output.state mid.sentence =
  395.             { "\btxnumberlong{}" }
  396.             { "\Btxnumberlong{}" }
  397.           if$
  398.           number tie.or.space.connect
  399.           series empty$
  400.             { "there's a number but no series in " cite$ * warning$ }
  401.             { " \btxinserieslong{}\ " * series emphasize * }
  402.           if$
  403.         }
  404.       if$
  405.     }
  406.     { "" }
  407.   if$
  408. }
  409.  
  410. FUNCTION {format.edition}
  411. { edition empty$
  412.     { "" }
  413.     {  "english" language.state.test
  414.        "USenglish" language.state.test
  415.       or
  416.         { output.state mid.sentence =
  417.             { edition "l" change.case$ " \btxeditionlong{}" * }
  418.             { edition "t" change.case$ " \btxeditionlong{}" * }
  419.           if$
  420.         }
  421.         { edition " \btxeditionlong{}" * }
  422.       if$
  423.     }
  424.   if$
  425. }
  426.  
  427. INTEGERS { multiresult }
  428.  
  429. FUNCTION {multi.page.check}
  430. { 't :=
  431.   #0 'multiresult :=
  432.     { multiresult not
  433.       t empty$ not
  434.       and
  435.     }
  436.     { t #1 #1 substring$
  437.       duplicate$ "-" =
  438.       swap$ duplicate$ "," =
  439.       swap$ "+" =
  440.       or or
  441.         { #1 'multiresult := }
  442.         { t #2 global.max$ substring$ 't := }
  443.       if$
  444.     }
  445.   while$
  446.   multiresult
  447. }
  448.  
  449. FUNCTION {format.pages}
  450. { pages empty$
  451.     { "" }
  452.     { pages multi.page.check
  453.         { "\btxpageslong{}" pages n.dashify tie.or.space.connect }
  454.         { "\btxpagelong{}" pages tie.or.space.connect }
  455.       if$
  456.     }
  457.   if$
  458. }
  459.  
  460. FUNCTION {format.vol.num.pages}
  461. { volume field.or.null
  462.   number empty$
  463.     'skip$
  464.     { "(" number * ")" * *
  465.       volume empty$
  466.         { "there's a number but no volume in " cite$ * warning$ }
  467.         'skip$
  468.       if$
  469.     }
  470.   if$
  471.   pages empty$
  472.     'skip$
  473.     { duplicate$ empty$
  474.         { pop$ format.pages }
  475.         { ":" * pages n.dashify * }
  476.       if$
  477.     }
  478.   if$
  479. }
  480.  
  481. FUNCTION {format.chapter.pages}
  482. { chapter empty$
  483.     'format.pages
  484.     { type empty$
  485.         { "\btxchapterlong{}" }
  486.         {  "english" language.state.test
  487.            "USenglish" language.state.test
  488.           or
  489.              { type "l" change.case$ }
  490.              { type }
  491.          if$
  492.         }
  493.       if$
  494.       chapter tie.or.space.connect
  495.       pages empty$
  496.         'skip$
  497.         { ", " * format.pages * }
  498.       if$
  499.     }
  500.   if$
  501. }
  502.  
  503. FUNCTION {format.in.ed.booktitle}
  504. { booktitle empty$
  505.     { "" }
  506.     { editor empty$
  507.         { "\Btxinlong{}\ " booktitle emphasize * }
  508.         { "\Btxinlong{}\ " format.editors * ": " * booktitle emphasize * }
  509.       if$
  510.     }
  511.   if$
  512. }
  513.  
  514. FUNCTION {empty.misc.check}
  515. { author empty$ title empty$ howpublished empty$
  516.   month empty$ year empty$ note empty$
  517.   and and and and and
  518.   key empty$ not and
  519.     { "all relevant fields are empty in " cite$ * warning$ }
  520.     'skip$
  521.   if$
  522. }
  523.  
  524. FUNCTION {format.thesis.type}
  525. { type empty$
  526.     'skip$
  527.     { pop$
  528.        "english" language.state.test
  529.        "USenglish" language.state.test
  530.       or
  531.         { type "t" change.case$ }
  532.         { type }
  533.       if$
  534.     }
  535.   if$
  536. }
  537.  
  538. FUNCTION {format.tr.number}
  539. { type empty$
  540.     { "\Btxtechreplong{}" }
  541.     'type
  542.   if$
  543.   number empty$
  544.     {  "english" language.state.test
  545.        "USenglish" language.state.test
  546.       or
  547.         { type empty$
  548.             { pop$ "\btxtechreplong{}" }
  549.             { "t" change.case$ }
  550.           if$
  551.         }
  552.         'skip$
  553.       if$
  554.     }
  555.     { number tie.or.space.connect }
  556.   if$
  557. }
  558.  
  559. FUNCTION {format.article.crossref}
  560. { key empty$
  561.     { journal empty$
  562.         { "need key or journal for " cite$ * " to crossref " * crossref *
  563.           warning$
  564.           ""
  565.         }
  566.         { "\Btxinlong{}\ " journal emphasize * }
  567.       if$
  568.     }
  569.     { "\Btxinlong{}\ " key emphasize * }
  570.   if$
  571.   " \cite{" * crossref * "}" *
  572. }
  573.  
  574. FUNCTION {format.crossref.editor}
  575. { editor #1 "{ll}{, jj}{, ff}{~vv}" format.name$ smallcaps
  576.   editor num.names$ duplicate$
  577.   #2 >
  578.     { pop$ " \btxetalshort{.}" * }
  579.     { #2 <
  580.         'skip$
  581.         { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  582.             { " \btxetalshort{.}" * }
  583.             { " \btxandlong{}\ " * editor #2 "{ff}{~vv}{~ll}{, jj}" format.name$ smallcaps * }
  584.           if$
  585.         }
  586.       if$
  587.     }
  588.   if$
  589. }
  590.  
  591. FUNCTION {format.book.crossref}
  592. { volume empty$
  593.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  594.       "\Btxinlong{}\ "
  595.     }
  596.     { "\Btxvolumelong{}" volume tie.or.space.connect
  597.       " \btxofserieslong{}\ " *
  598.     }
  599.   if$
  600.   editor empty$
  601.   editor field.or.null author field.or.null =
  602.   or
  603.     { key empty$
  604.         { series empty$
  605.             { "need editor, key, or series for " cite$ * " to crossref " *
  606.               crossref * warning$
  607.               "" *
  608.             }
  609.             { series emphasize * }
  610.           if$
  611.         }
  612.         { key emphasize * }
  613.       if$
  614.     }
  615.     { format.crossref.editor * }
  616.   if$
  617.   " \cite{" * crossref * "}" *
  618. }
  619.  
  620. FUNCTION {format.incoll.inproc.crossref}
  621. { editor empty$
  622.   editor field.or.null author field.or.null =
  623.   or
  624.     { key empty$
  625.         { booktitle empty$
  626.             { "need editor, key, or booktitle for " cite$ * " to crossref " *
  627.               crossref * warning$
  628.               ""
  629.             }
  630.             { "\Btxinlong{}\ " booktitle emphasize * }
  631.           if$
  632.         }
  633.         { "\Btxinlong{}\ " key emphasize * }
  634.       if$
  635.     }
  636.     { "\Btxinlong{}\ " format.crossref.editor * }
  637.   if$
  638.   " \cite{" * crossref * "}" *
  639. }
  640.  
  641. FUNCTION {article}
  642. { output.bibitem
  643.   format.authors "author" output.check
  644.   after.authors
  645.   format.title "title" output.check
  646.   new.block
  647.   crossref missing$
  648.     { journal 
  649.       title missing$
  650.         { emphasize }
  651.         'skip$
  652.       if$
  653.       "journal" output.check 
  654.       format.vol.num.pages output
  655.       format.date "year" output.check
  656.     }
  657.     { format.article.crossref output.nonnull
  658.       format.pages output
  659.     }
  660.   if$
  661.   new.block
  662.   note output
  663.   fin.entry
  664. }
  665.  
  666. FUNCTION {book}
  667. { output.bibitem
  668.   author empty$
  669.     { format.editors "author and editor" output.check }
  670.     { format.authors output.nonnull
  671.       crossref missing$
  672.         { "author and editor" editor either.or.check }
  673.         'skip$
  674.       if$
  675.     }
  676.   if$
  677.   after.authors
  678.   format.btitle "title" output.check
  679.   crossref missing$
  680.     { format.bvolume output
  681.       new.block
  682.       format.number.series output
  683.       new.sentence
  684.       publisher "publisher" output.check
  685.       address output
  686.     }
  687.     { new.block
  688.       format.book.crossref output.nonnull
  689.     }
  690.   if$
  691.   format.edition output
  692.   format.date "year" output.check
  693.   new.block
  694.   note output
  695.   fin.entry
  696. }
  697.  
  698. FUNCTION {booklet}
  699. { output.bibitem
  700.   format.authors output
  701.   after.authors
  702.   format.title "title" output.check
  703.   howpublished address new.block.checkb
  704.   howpublished output
  705.   address output
  706.   format.date output
  707.   new.block
  708.   note output
  709.   fin.entry
  710. }
  711.  
  712. FUNCTION {inbook}
  713. { output.bibitem
  714.   author empty$
  715.     { format.editors "author and editor" output.check }
  716.     { format.authors output.nonnull
  717.       crossref missing$
  718.         { "author and editor" editor either.or.check }
  719.         'skip$
  720.       if$
  721.     }
  722.   if$
  723.   after.authors
  724.   format.btitle "title" output.check
  725.   crossref missing$
  726.     { format.bvolume output
  727.       format.chapter.pages "chapter and pages" output.check
  728.       new.block
  729.       format.number.series output
  730.       new.sentence
  731.       publisher "publisher" output.check
  732.       address output
  733.     }
  734.     { format.chapter.pages "chapter and pages" output.check
  735.       new.block
  736.       format.book.crossref output.nonnull
  737.     }
  738.   if$
  739.   format.edition output
  740.   format.date "year" output.check
  741.   new.block
  742.   note output
  743.   fin.entry
  744. }
  745.  
  746. FUNCTION {incollection}
  747. { output.bibitem
  748.   format.authors "author" output.check
  749.   after.authors
  750.   format.title "title" output.check
  751.   new.block
  752.   crossref missing$
  753.     { format.in.ed.booktitle "booktitle" output.check
  754.       format.bvolume output
  755.       format.number.series output
  756.       format.chapter.pages output
  757.       new.sentence
  758.       publisher "publisher" output.check
  759.       address output
  760.       format.edition output
  761.       format.date "year" output.check
  762.     }
  763.     { format.incoll.inproc.crossref output.nonnull
  764.       format.chapter.pages output
  765.     }
  766.   if$
  767.   new.block
  768.   note output
  769.   fin.entry
  770. }
  771.  
  772. FUNCTION {inproceedings}
  773. { output.bibitem
  774.   format.authors "author" output.check
  775.   after.authors
  776.   format.title "title" output.check
  777.   new.block
  778.   crossref missing$
  779.     { format.in.ed.booktitle "booktitle" output.check
  780.       format.bvolume output
  781.       format.number.series output
  782.       format.pages output
  783.       address empty$
  784.         { organization publisher new.sentence.checkb
  785.           organization output
  786.           publisher output
  787.           format.date "year" output.check
  788.         }
  789.         { address output.nonnull
  790.           format.date "year" output.check
  791.           new.sentence
  792.           organization output
  793.           publisher output
  794.         }
  795.       if$
  796.     }
  797.     { format.incoll.inproc.crossref output.nonnull
  798.       format.pages output
  799.     }
  800.   if$
  801.   new.block
  802.   note output
  803.   fin.entry
  804. }
  805.  
  806. FUNCTION {conference} { inproceedings }
  807.  
  808. FUNCTION {manual}
  809. { output.bibitem
  810.   author empty$
  811.     { organization empty$
  812.         'skip$
  813.         { organization smallcaps output.nonnull
  814.           address output
  815.         }
  816.       if$
  817.     }
  818.     { format.authors output.nonnull }
  819.   if$
  820.   after.authors
  821.   format.btitle "title" output.check
  822.   author empty$
  823.     { organization empty$
  824.         { address new.block.checka
  825.           address output
  826.         }
  827.         'skip$
  828.       if$
  829.     }
  830.     { organization address new.block.checkb
  831.       organization output
  832.       address output
  833.     }
  834.   if$
  835.   format.edition output
  836.   format.date output
  837.   new.block
  838.   note output
  839.   fin.entry
  840. }
  841.  
  842. FUNCTION {mastersthesis}
  843. { output.bibitem
  844.   format.authors "author" output.check
  845.   after.authors
  846.   format.title "title" output.check
  847.   new.block
  848.   "\btxmastthesis{}" format.thesis.type output.nonnull
  849.   school "school" output.check
  850.   address output
  851.   format.date "year" output.check
  852.   new.block
  853.   note output
  854.   fin.entry
  855. }
  856.  
  857. FUNCTION {misc}
  858. { output.bibitem
  859.   format.authors output
  860.   title howpublished new.block.checkc
  861.   format.title output
  862.   howpublished new.block.checka
  863.   howpublished output
  864.   format.date output
  865.   new.block
  866.   note output
  867.   fin.entry
  868.   empty.misc.check
  869. }
  870.  
  871. FUNCTION {phdthesis}
  872. { output.bibitem
  873.   format.authors "author" output.check
  874.   after.authors
  875.   format.btitle "title" output.check
  876.   new.block
  877.   "\btxphdthesis{}" format.thesis.type output.nonnull
  878.   school "school" output.check
  879.   address output
  880.   format.date "year" output.check
  881.   new.block
  882.   note output
  883.   fin.entry
  884. }
  885.  
  886. FUNCTION {proceedings}
  887. { output.bibitem
  888.   editor empty$
  889.     { organization smallcaps output }
  890.     { format.editors output.nonnull }
  891.   if$
  892.   after.authors
  893.   format.btitle "title" output.check
  894.   format.bvolume output
  895.   format.number.series output
  896.   address empty$
  897.     { editor empty$
  898.         { publisher new.sentence.checka }
  899.         { organization publisher new.sentence.checkb
  900.           organization output
  901.         }
  902.       if$
  903.       publisher output
  904.       format.date "year" output.check
  905.     }
  906.     { address output.nonnull
  907.       format.date "year" output.check
  908.       new.sentence
  909.       editor empty$
  910.         'skip$
  911.         { organization output }
  912.       if$
  913.       publisher output
  914.     }
  915.   if$
  916.   new.block
  917.   note output
  918.   fin.entry
  919. }
  920.  
  921. FUNCTION {techreport}
  922. { output.bibitem
  923.   format.authors "author" output.check
  924.   after.authors
  925.   format.title "title" output.check
  926.   new.block
  927.   format.tr.number output.nonnull
  928.   institution "institution" output.check
  929.   address output
  930.   format.date "year" output.check
  931.   new.block
  932.   note output
  933.   fin.entry
  934. }
  935.  
  936. FUNCTION {unpublished}
  937. { output.bibitem
  938.   format.authors "author" output.check
  939.   after.authors
  940.   format.title "title" output.check
  941.   new.block
  942.   note "note" output.check
  943.   format.date output
  944.   fin.entry
  945. }
  946.  
  947. FUNCTION {default.type} { misc }
  948.  
  949. MACRO {jan} {"\btxmonjanlong{}"}
  950.  
  951. MACRO {feb} {"\btxmonfeblong{}"}
  952.  
  953. MACRO {mar} {"\btxmonmarlong{}"}
  954.  
  955. MACRO {apr} {"\btxmonaprlong{}"}
  956.  
  957. MACRO {may} {"\btxmonmaylong{}"}
  958.  
  959. MACRO {jun} {"\btxmonjunlong{}"}
  960.  
  961. MACRO {jul} {"\btxmonjullong{}"}
  962.  
  963. MACRO {aug} {"\btxmonauglong{}"}
  964.  
  965. MACRO {sep} {"\btxmonseplong{}"}
  966.  
  967. MACRO {oct} {"\btxmonoctlong{}"}
  968.  
  969. MACRO {nov} {"\btxmonnovlong{}"}
  970.  
  971. MACRO {dec} {"\btxmondeclong{}"}
  972.  
  973. MACRO {acmcs} {"ACM Computing Surveys"}
  974.  
  975. MACRO {acta} {"Acta Informatica"}
  976.  
  977. MACRO {cacm} {"Communications of the ACM"}
  978.  
  979. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  980.  
  981. MACRO {ibmsj} {"IBM Systems Journal"}
  982.  
  983. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  984.  
  985. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  986.  
  987. MACRO {ieeetcad}
  988.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  989.  
  990. MACRO {ipl} {"Information Processing Letters"}
  991.  
  992. MACRO {jacm} {"Journal of the ACM"}
  993.  
  994. MACRO {jcss} {"Journal of Computer and System Sciences"}
  995.  
  996. MACRO {scp} {"Science of Computer Programming"}
  997.  
  998. MACRO {sicomp} {"SIAM Journal on Computing"}
  999.  
  1000. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1001.  
  1002. MACRO {tods} {"ACM Transactions on Database Systems"}
  1003.  
  1004. MACRO {tog} {"ACM Transactions on Graphics"}
  1005.  
  1006. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1007.  
  1008. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1009.  
  1010. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1011.  
  1012. MACRO {tcs} {"Theoretical Computer Science"}
  1013.  
  1014. READ
  1015.  
  1016. FUNCTION {sortify}
  1017. { purify$
  1018.   "l" change.case$
  1019. }
  1020.  
  1021. INTEGERS { len }
  1022.  
  1023. FUNCTION {chop.word}
  1024. { 's :=
  1025.   'len :=
  1026.   s #1 len substring$ =
  1027.     { s len #1 + global.max$ substring$ }
  1028.     's
  1029.   if$
  1030. }
  1031.  
  1032. INTEGERS { et.al.char.used }
  1033.  
  1034. FUNCTION {initialize.et.al.char.used}
  1035. { #0 'et.al.char.used :=
  1036. }
  1037.  
  1038. EXECUTE {initialize.et.al.char.used}
  1039.  
  1040. FUNCTION {format.lab.names}
  1041. { 's :=
  1042.   s num.names$ 'numnames :=
  1043.   numnames #1 >
  1044.     { numnames #4 >
  1045.   { #3 'namesleft := }
  1046.   { numnames 'namesleft := }
  1047.       if$
  1048.       #1 'nameptr :=
  1049.       ""
  1050.   { namesleft #0 > }
  1051.   { nameptr numnames =
  1052.       { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1053.     { "{\etalchar{+}}" *
  1054.       #1 'et.al.char.used :=
  1055.     }
  1056.     { s nameptr "{v{}}{l{}}" format.name$ * }
  1057.         if$
  1058.       }
  1059.       { s nameptr "{v{}}{l{}}" format.name$ * }
  1060.     if$
  1061.     nameptr #1 + 'nameptr :=
  1062.     namesleft #1 - 'namesleft :=
  1063.   }
  1064.       while$
  1065.       numnames #4 >
  1066.   { "{\etalchar{+}}" *
  1067.     #1 'et.al.char.used :=
  1068.   }
  1069.   'skip$
  1070.       if$
  1071.     }
  1072.     { s #1 "{v{}}{l{}}" format.name$
  1073.       duplicate$ text.length$ #2 <
  1074.   { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
  1075.   'skip$
  1076.       if$
  1077.     }
  1078.   if$
  1079. }
  1080.  
  1081. FUNCTION {author.key.label}
  1082. { author empty$
  1083.     { key empty$
  1084.   { cite$ #1 #3 substring$ }
  1085.   { key #3 text.prefix$ }
  1086.       if$
  1087.     }
  1088.     { author format.lab.names }
  1089.   if$
  1090. }
  1091.  
  1092. FUNCTION {author.editor.key.label}
  1093. { author empty$
  1094.     { editor empty$
  1095.   { key empty$
  1096.       { cite$ #1 #3 substring$ }
  1097.       { key #3 text.prefix$ }
  1098.     if$
  1099.   }
  1100.   { editor format.lab.names }
  1101.       if$
  1102.     }
  1103.     { author format.lab.names }
  1104.   if$
  1105. }
  1106.  
  1107. FUNCTION {author.key.organization.label}
  1108. { author empty$
  1109.     { key empty$
  1110.   { organization empty$
  1111.       { cite$ #1 #3 substring$ }
  1112.       { "The " #4 organization chop.word #3 text.prefix$ }
  1113.     if$
  1114.   }
  1115.   { key #3 text.prefix$ }
  1116.       if$
  1117.     }
  1118.     { author format.lab.names }
  1119.   if$
  1120. }
  1121.  
  1122. FUNCTION {editor.key.organization.label}
  1123. { editor empty$
  1124.     { key empty$
  1125.   { organization empty$
  1126.       { cite$ #1 #3 substring$ }
  1127.       { "The " #4 organization chop.word #3 text.prefix$ }
  1128.     if$
  1129.   }
  1130.   { key #3 text.prefix$ }
  1131.       if$
  1132.     }
  1133.     { editor format.lab.names }
  1134.   if$
  1135. }
  1136.  
  1137. FUNCTION {calc.label}
  1138. { type$ "book" =
  1139.   type$ "inbook" =
  1140.   or
  1141.     'author.editor.key.label
  1142.     { type$ "proceedings" =
  1143.   'editor.key.organization.label
  1144.   { type$ "manual" =
  1145.       'author.key.organization.label
  1146.       'author.key.label
  1147.     if$
  1148.   }
  1149.       if$
  1150.     }
  1151.   if$
  1152.   duplicate$
  1153.   year field.or.null purify$ #-1 #2 substring$
  1154.   *
  1155.   'label :=
  1156.   year field.or.null purify$ #-1 #4 substring$
  1157.   *
  1158.   sortify 'sort.label :=
  1159. }
  1160.  
  1161. FUNCTION {sort.format.names}
  1162. { 's :=
  1163.   #1 'nameptr :=
  1164.   ""
  1165.   s num.names$ 'numnames :=
  1166.   numnames 'namesleft :=
  1167.     { namesleft #0 > }
  1168.     { nameptr #1 >
  1169.   { "   " * }
  1170.   'skip$
  1171.       if$
  1172.       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  1173.       nameptr numnames = t "others" = and
  1174.   { "et al" * }
  1175.   { t sortify * }
  1176.       if$
  1177.       nameptr #1 + 'nameptr :=
  1178.       namesleft #1 - 'namesleft :=
  1179.     }
  1180.   while$
  1181. }
  1182.  
  1183. FUNCTION {sort.format.title}
  1184. { 't :=
  1185.   "A " #2
  1186.     "An " #3
  1187.       "The " #4 t chop.word
  1188.     chop.word
  1189.   chop.word
  1190.   sortify
  1191.   #1 global.max$ substring$
  1192. }
  1193.  
  1194. FUNCTION {author.sort}
  1195. { author empty$
  1196.     { key empty$
  1197.   { "to sort, need author or key in " cite$ * warning$
  1198.     ""
  1199.   }
  1200.   { key sortify }
  1201.       if$
  1202.     }
  1203.     { author sort.format.names }
  1204.   if$
  1205. }
  1206.  
  1207. FUNCTION {author.editor.sort}
  1208. { author empty$
  1209.     { editor empty$
  1210.   { key empty$
  1211.       { "to sort, need author, editor, or key in " cite$ * warning$
  1212.         ""
  1213.       }
  1214.       { key sortify }
  1215.     if$
  1216.   }
  1217.   { editor sort.format.names }
  1218.       if$
  1219.     }
  1220.     { author sort.format.names }
  1221.   if$
  1222. }
  1223.  
  1224. FUNCTION {author.organization.sort}
  1225. { author empty$
  1226.     { organization empty$
  1227.   { key empty$
  1228.       { "to sort, need author, organization, or key in " cite$ * warning$
  1229.         ""
  1230.       }
  1231.       { key sortify }
  1232.     if$
  1233.   }
  1234.   { "The " #4 organization chop.word sortify }
  1235.       if$
  1236.     }
  1237.     { author sort.format.names }
  1238.   if$
  1239. }
  1240.  
  1241. FUNCTION {editor.organization.sort}
  1242. { editor empty$
  1243.     { organization empty$
  1244.   { key empty$
  1245.       { "to sort, need editor, organization, or key in " cite$ * warning$
  1246.         ""
  1247.       }
  1248.       { key sortify }
  1249.     if$
  1250.   }
  1251.   { "The " #4 organization chop.word sortify }
  1252.       if$
  1253.     }
  1254.     { editor sort.format.names }
  1255.   if$
  1256. }
  1257.  
  1258. FUNCTION {presort}
  1259. { calc.label
  1260.   sort.label
  1261.   "    "
  1262.   *
  1263.   type$ "book" =
  1264.   type$ "inbook" =
  1265.   or
  1266.     'author.editor.sort
  1267.     { type$ "proceedings" =
  1268.   'editor.organization.sort
  1269.   { type$ "manual" =
  1270.       'author.organization.sort
  1271.       'author.sort
  1272.     if$
  1273.   }
  1274.       if$
  1275.     }
  1276.   if$
  1277.   *
  1278.   "    "
  1279.   *
  1280.   year field.or.null sortify
  1281.   *
  1282.   "    "
  1283.   *
  1284.   title field.or.null
  1285.   sort.format.title
  1286.   *
  1287.   #1 entry.max$ substring$
  1288.   'sort.key$ :=
  1289. }
  1290.  
  1291. ITERATE {presort}
  1292.  
  1293. SORT
  1294.  
  1295. STRINGS { longest.label last.sort.label next.extra }
  1296.  
  1297. INTEGERS { longest.label.width last.extra.num }
  1298.  
  1299. FUNCTION {initialize.longest.label}
  1300. { "" 'longest.label :=
  1301.   #0 int.to.chr$ 'last.sort.label :=
  1302.   "" 'next.extra :=
  1303.   #0 'longest.label.width :=
  1304.   #0 'last.extra.num :=
  1305. }
  1306.  
  1307. FUNCTION {forward.pass}
  1308. { last.sort.label sort.label =
  1309.     { last.extra.num #1 + 'last.extra.num :=
  1310.       last.extra.num int.to.chr$ 'extra.label :=
  1311.     }
  1312.     { "a" chr.to.int$ 'last.extra.num :=
  1313.       "" 'extra.label :=
  1314.       sort.label 'last.sort.label :=
  1315.     }
  1316.   if$
  1317. }
  1318.  
  1319. FUNCTION {reverse.pass}
  1320. { next.extra "b" =
  1321.     { "a" 'extra.label := }
  1322.     'skip$
  1323.   if$
  1324.   label extra.label * 'label :=
  1325.   label width$ longest.label.width >
  1326.     { label 'longest.label :=
  1327.       label width$ 'longest.label.width :=
  1328.     }
  1329.     'skip$
  1330.   if$
  1331.   extra.label 'next.extra :=
  1332. }
  1333.  
  1334. EXECUTE {initialize.longest.label}
  1335.  
  1336. ITERATE {forward.pass}
  1337.  
  1338. REVERSE {reverse.pass}
  1339.  
  1340. FUNCTION {begin.bib}
  1341. { et.al.char.used
  1342.     { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
  1343.     'skip$
  1344.   if$
  1345.   preamble$ empty$
  1346.     'skip$
  1347.     { preamble$ write$ newline$ }
  1348.   if$
  1349.   "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  1350. }
  1351.  
  1352. EXECUTE {begin.bib}
  1353.  
  1354. EXECUTE {init.state.consts}
  1355.  
  1356. ITERATE {call.type$}
  1357.  
  1358. FUNCTION {end.bib}
  1359. { newline$
  1360.   "\end{thebibliography}" write$ newline$
  1361. }
  1362.  
  1363. EXECUTE {end.bib}
  1364.  
  1365.